﻿using System.Collections.ObjectModel;
using System.Windows.Controls;

using Game.Terrain;
using Game.Toolkit;

namespace Game.Editor.Toolbox
{
    public class TerrainControl2 : UserControl
    {
        readonly WrapPanel _Panel = new WrapPanel();

        public TerrainControl2()
        {
            InitializeComponent();
            Init();
        }

        void InitializeComponent()
        {
            Grid grid = new Grid();
            this.Content = grid;
            ScrollViewer viewer = new ScrollViewer();
            grid.Children.Add(viewer);
            viewer.Content = _Panel;
        }

        private void Init()
        {
            Collection<TerrainType> col = StandardToolkit.TerrainTypes;
            foreach (TerrainType v in col)
            {
                TerrainItemControl2 control = new TerrainItemControl2();
                control.TerrainType = v;
                control.Width = 50;
                control.Height = 50;
                _Panel.Children.Add(control);
            }
        }
    }
}
